/**
 * Created by zhangdawei on 2016/8/12.
 */
app.controller('channelCtrl', function ($scope, ChannelService, $timeout) {
    var msgBox = null;
    //页面初始化加载
    var getAllChannels = function () {
        ChannelService.findAllChannel({
            action: 'findAllChannel'
        }, function (data) {
            //展示数据
            if (data.state == 'SUCCESS') {
                $scope.channels = data.data.listChannel;
            } else {
                if (msgBox == null) {
                    msgBox = message_alert('提示',data.reason, function () {
                        msgBox = null;
                    });
                }
            }
        });
        $timeout(function () {
            getAllChannels();
        }, $scope.selectTime);
    };
    $scope.changeTime = function (time) {
        $scope.selectTime = time;
    };
    getAllChannels();
});
